home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / buildViewMenu.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  6.3 KB  |  200 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Author:         cdt
  22. //
  23. //  Procedure Name:
  24. //      buildViewMenu
  25. //
  26. //  Description:
  27. //        Builds all the items in the View menu when
  28. //        the user clicks on the menu.  Checks to see if
  29. //        there are any children in the menu already, and
  30. //        if so, doesn't rebuild the menu.
  31. //
  32. //  Input Arguments:
  33. //      Name of the parent menu.
  34. //
  35. //  Return Value:
  36. //      None.
  37. //
  38.  
  39.  
  40. global proc string saveCurrentPanelLayout() {
  41.  
  42.     global string $gMainWindow;
  43.     global string $gMainPane;
  44.     global string $gPanelEditorWnd;
  45.     string $text = "New Layout";
  46.     string $layoutName = "";
  47.     string $config, $configArray[];
  48.  
  49.     string $result = `promptDialog 
  50.         -title "Save Panel Arrangement"
  51.         -message "Enter Name for Arrangement:" 
  52.         -text $text
  53.         -button "OK" 
  54.         -button "Cancel" 
  55.         -defaultButton "OK" 
  56.         -cancelButton "Cancel" 
  57.         -dismissString "Cancel"
  58.         -parent $gMainWindow`;
  59.  
  60.     //
  61.     // If the result was "OK", then proceed
  62.     //
  63.     if ( $result == "OK" ) {
  64.  
  65.         $layoutName = `promptDialog -query`;
  66.  
  67.         //    First check if the name is unique.
  68.         //
  69.         $configArray = `getPanel -allConfigs`;
  70.         for ($config in $configArray) {
  71.             if ($layoutName == `panelConfiguration -query -label $config`) {
  72.  
  73.                 confirmDialog
  74.                     -title "Warning"
  75.                     -message ("A layout with the name \"" + $layoutName + 
  76.                         "\" already exists.\nPlease choose another.")
  77.                     -button "Close"
  78.                     -parent $gMainWindow;
  79.                 return "";
  80.             }
  81.         }
  82.  
  83.         string $newConfigName = `panelConfiguration -sc false`;
  84.         panelConfiguration -edit -label $layoutName $newConfigName;
  85.         updatePanelLayoutFromCurrent $layoutName;
  86.  
  87.         //  special case for top,front,side,persp
  88.         //        -make sure they always reset their state.
  89.         //
  90.         int    $i,$nArr;
  91.         string $labels[];
  92.     
  93.         $labels = `panelConfiguration -q -labelStrings $newConfigName`;
  94.         
  95.         $nArr = size($labels);
  96.         for ($i = 0; $i < $nArr; $i++) {
  97.             if ("Persp View" == $labels[$i] ||
  98.                 "Top View" == $labels[$i] ||
  99.                 "Side View" == $labels[$i] ||
  100.                 "Front View" == $labels[$i])
  101.             {
  102.                 panelConfiguration -e -rfs ($i+1) true $newConfigName;
  103.             }
  104.         }
  105.     }
  106.  
  107.     return $layoutName;
  108. }
  109.  
  110.  
  111. global proc buildViewMenu( string $parent )
  112. {
  113.     string $menu;
  114.     setParent -m $parent;
  115.  
  116.     if( `menu -q -ni $parent` != 0 ) {
  117.         //
  118.         //    Menu is already built - just return
  119.         //
  120.         return;
  121.     }
  122.     
  123.     WindowMenu $parent;
  124.  
  125.     menuItem -divider true;
  126.  
  127.     menuItem -l "View Arrangement" -subMenu true -tearOff true;
  128.  
  129.         menuItem -label "Single Pane" -command "SingleViewArrangement"
  130.             -annotation (getRunTimeCommandAnnotation("SingleViewArrangement"));
  131.  
  132.         menuItem -label "Two Panes Side by Side" -command "TwoSideBySideViewArrangement"
  133.             -annotation (getRunTimeCommandAnnotation("TwoSideBySideViewArrangement"));
  134.  
  135.         menuItem -label "Two Panes Stacked" -command "TwoStackedViewArrangement"
  136.             -annotation (getRunTimeCommandAnnotation("TwoStackedViewArrangement"));
  137.  
  138.         menuItem -label "Three Panes Split Top " -command "ThreeTopSplitViewArrangement"
  139.             -annotation (getRunTimeCommandAnnotation("ThreeTopSplitViewArrangement"));
  140.         menuItem -label "Three Panes Split Left" -command "ThreeLeftSplitViewArrangement"
  141.             -annotation (getRunTimeCommandAnnotation("ThreeLeftSplitViewArrangement"));
  142.         menuItem -label "Three Panes Split Bottom" -command "ThreeBottomSplitViewArrangement"
  143.             -annotation (getRunTimeCommandAnnotation("ThreeBottomSplitViewArrangement"));
  144.         menuItem -label "Three Panes Split Right" -command "ThreeRightSplitViewArrangement"
  145.             -annotation (getRunTimeCommandAnnotation("ThreeRightSplitViewArrangement"));
  146.  
  147.         menuItem -label "Four Panes" -command "FourViewArrangement"
  148.             -annotation (getRunTimeCommandAnnotation("FourViewArrangement"));
  149.         
  150.         menuItem -divider true;
  151.  
  152.         menuItem -label "Previous Arrangement" 
  153.             -annotation (getRunTimeCommandAnnotation("PreviousViewArrangement"))
  154.             -command "PreviousViewArrangement";
  155.         menuItem -label "Next Arrangement" 
  156.             -annotation (getRunTimeCommandAnnotation("NextViewArrangement"))
  157.             -command "NextViewArrangement";
  158.  
  159.     setParent -menu ..;
  160.  
  161.     $menu = `menuItem -l "Saved Layouts" -subMenu true`;
  162.     menuItem -e -pmc ("buildNamedArrangementsNow " + $menu) $menu;
  163.     setParent -m ..;
  164.  
  165.     menuItem -l "Save Current Layout..." 
  166.         -annotation "Save Current Layout: Save the current layout of the panels"
  167.         -c "SaveCurrentLayout";
  168.  
  169.     menuItem -divider true;
  170.  
  171.     menuItem -l "Frame All in All Views" 
  172.         -annotation "Frame All in All Views: Change the cameras to frame all objects in the view"
  173.         -c "FrameAllInAllViews";
  174.     menuItem -l "Frame Selection in All Views" 
  175.         -annotation "Frame Selection in All Views: Change the cameras to frame the selected object(s) in the view"
  176.         -c "FrameSelectedInAllViews";
  177.  
  178.     menuItem -divider true;
  179.  
  180.     if (!`about -mac`) {
  181.         menuItem -label "Minimize Application" 
  182.             -annotation "Minimize Application: Minimize Maya into one icon"
  183.             -command "MinimizeApplication";
  184.     }
  185.  
  186.     if (`about -mac`) {
  187.         menuItem -label "Console Window..."
  188.             -annotation "Console Window: Show the console window"
  189.             -command "showWindow ConsoleWindow";
  190.     }
  191.  
  192.     menuItem -label "Raise Main Window"
  193.         -annotation "Raise Main Window: Brings main Maya window to the front of the stack"
  194.         -command "RaiseMainWindow";
  195.  
  196.     menuItem -label "Raise Application Windows" 
  197.         -annotation "Raise Application Windows: Raises Maya windows in no particular order"
  198.         -command "RaiseApplicationWindows";
  199. }
  200.